/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */

import lombok.Data;

import java.util.concurrent.TimeUnit;

/**
 * <p>Project: jse2204 - T16
 * <p>Powered by webrx On 2022-10-09 10:11:45
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@Data
public class T16 {

    void m(){
        String t = Thread.currentThread().getName();
        for (int i = 0; i < 3; i++) {
            try{
                TimeUnit.SECONDS.sleep(1);
            }catch(Exception e){
                e.printStackTrace();
            }
            System.out.printf("%s:%d%n",t,i);
        }
    }

    public static void main(String[] args) throws Exception {
        T16 t = new T16();
        Thread t1 = new Thread(t::m,"t1");
        Thread t2 = new Thread(t::m,"t2");
        Thread t3 = new Thread(t::m,"t3");
        t3.start();
        t3.join();
        t2.start();
        t2.join();


        t1.start();


        t.m();
    }
}
